class NationalsController < ApplicationController
  # GET /nationals
  # GET /nationals.xml
  def index
    @nationals = National.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @nationals }
    end
  end

  # GET /nationals/1
  # GET /nationals/1.xml
  def show
    @national = National.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @national }
    end
  end

  # GET /nationals/new
  # GET /nationals/new.xml
  def new
    @national = National.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @national }
    end
  end

  # GET /nationals/1/edit
  def edit
    @national = National.find(params[:id])
  end

  # POST /nationals
  # POST /nationals.xml
  def create
    @national = National.new(params[:national])

    respond_to do |format|
      if @national.save
        flash[:notice] = 'National was successfully created.'
        format.html { redirect_to(@national) }
        format.xml  { render :xml => @national, :status => :created, :location => @national }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @national.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /nationals/1
  # PUT /nationals/1.xml
  def update
    @national = National.find(params[:id])

    respond_to do |format|
      if @national.update_attributes(params[:national])
        flash[:notice] = 'National was successfully updated.'
        format.html { redirect_to(@national) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @national.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /nationals/1
  # DELETE /nationals/1.xml
  def destroy
    @national = National.find(params[:id])
    @national.destroy

    respond_to do |format|
      format.html { redirect_to(nationals_url) }
      format.xml  { head :ok }
    end
  end
end
